<template>
    <a-card :bordered="false">
      <detail-list title="基本信息">
        <detail-list-item term="店铺名称">{{shop.shopName}}</detail-list-item>
        <detail-list-item term="店铺类型">{{shopType}}</detail-list-item>
<!--        <detail-list-item term="公司名称">{{shop.companyName}}</detail-list-item>-->
        <detail-list-item term="商户手机">{{shop.mobile}}</detail-list-item>
        <detail-list-item term="公司电话">{{shop.telephone}}</detail-list-item>
<!--        <detail-list-item term="营业执照号">{{shop.licenseNumber}}</detail-list-item>-->
<!--        <detail-list-item term="税务登记号">{{shop.taxNumber}}</detail-list-item>-->
        <detail-list-item term="店铺地址">{{shop.shopAddress}}</detail-list-item>
        <detail-list-item term="开户行支行">{{shop.bankName}}</detail-list-item>
      </detail-list>
      <a-divider style="margin-bottom: 32px"/>
        <div class="examples" >
          <a-button style="margin-left:30px;" size="large"  @click="toShopAudit(1)"  type="primary">同意</a-button>
          <a-button style="margin-left:40px;"  size="large" @click="toShopAudit(2)"  type="danger" >打回</a-button>
        </div>
    </a-card>
</template>

<script>
  import PageLayout from '@/components/page/PageLayout'
  import STable from '@/components/table/'
  import DetailList from '@/components/tools/DetailList'
  import ABadge from "ant-design-vue/es/badge/Badge"
  const DetailListItem = DetailList.Item
  import Button  from 'ant-design-vue';
  import { postAction,getAction } from '@/api/manage'
  export default {
    components: {
      Button,
      ABadge,
      DetailList,
      DetailListItem,
      PageLayout,
      STable
    },
    data () {
      return {
        // successButton: false,
        // failButton:false,
        shop:{},
        shopId:"",
        shopType:"",
      }
    },
    filters: {
    },
    created(){
      this.shopId = this.$route.query.record.id;
      this.getShopDetails(this.$route.query.record.id);
    },
    mounted(){

    },
    activated(){
      this.getShopDetails(this.$route.query.record.id);
      // this.successButton=false
      // this.failButton=false
    },
    methods: {
      getShopDetails(id) {
        let shopId = {shopId:id};
        this.$nextTick(function () {
          getAction("/shop-api/shop/merchant/shopDetail",shopId)
            .then(res => {
              if (res.success) {
                this.shop = res.result
                if(res.result.shopType == 0){
                  return this.shopType = "百货"
                }else if(res.result.shopType == 1){
                  return this.shopType = "超市"
                }else {
                  return this.shopType = "五金"
                }
              }
            })
            .catch(err => {
            });
        })
      },
      //审核商铺
      toShopAudit(shopStatus){
        let this_ = this
        let obj = {id:this_.shopId,shopStatus:shopStatus};
        this.$nextTick(function () {
          postAction("/shop-api/shop/web/reviewShopInfo",obj)
            .then(res => {
              if (res.success) {
                alert(shopStatus)
                if(shopStatus == 1){
                  // this.successButton=true
                  this.$router.back()
                  Console.log(111111111111111)
                  this.$notification.success({
                    message: '审核结果',
                    description: `店铺 : `+"审核通过",
                  });
                }else {
                  // this.failButton=true
                  this.$router.back()
                  this.$notification.success({
                    message: '审核结果',
                    description: `店铺 : `+"驳回审核",
                  });
                }
              }
            })
            .catch(err => {

            });
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
  .examples {
    text-align: center;
  }
</style>